/**
 * Copyright (c) 2011 Tomi Paananen.
 *
 * Part of Quick Gestures engine library.
 */

#ifndef STORAGEMANAGER_H
#define STORAGEMANAGER_H

// Qt includes
#include <QList>
#include <QObject>
#include <QString>

// qgengine includes
#include "qgenginepriv.h"

// Forward declarations
class Gesture;
class XmlParser;


class QGLIB_EXPORT StorageManager : public QObject
{
    Q_OBJECT

public: // Construction and destruction
    explicit StorageManager(QObject *parent = 0);
    virtual ~StorageManager();

public:
    int getGestures(QList<Gesture*> &gestureSet);

protected:
    void deleteGestures();

public slots:
    int load(const QString &filepath);
    int save(const QString &filepath, QList<Gesture*> &gestureSet);
    void clear();

protected slots:
    void handleProgressChanged(int percentsComplete);

signals:
    void progress(int percentsComplete);
    void gestureRead(Gesture *gesture);

protected: // Data
    XmlParser *m_parser; // Owned
    QList<Gesture*> m_gestureSet; // Owned until ownership transferred
};


#endif // STORAGEMANAGER_H

// End of file.
